#!/bin/bash
echo "--------------------------------------1. build tool  --------------------------------------"
# 获取当前脚本所在路径
BASEPATH=$(cd "$(dirname $0)" || exit; pwd)
echo  $BASEPATH

mkdir -p build
mkdir -p bin
mkdir -p lib
cd build

rm -rf *
echo "--------------------------------------2. cmake & make--------------------------------------"
cmake .. -DHOME=${BASEPATH}

make

# 返回到脚本所在目录
cd ${BASEPATH} || exit
echo "--------------------------------------3. excute--------------------------------------"
# 执行可执行文件
${BASEPATH}/bin/app
echo "--------------------------------------4. exit  --------------------------------------"